//
//  GGTSingleBusinessTableViewCell.m
//  GGT
//
//  Created by 空空空 on 14/11/4.
//  Copyright (c) 2014年 GGT. All rights reserved.
//

#import "GGTSingleBusinessTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation GGTSingleBusinessTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel];
//        self.mongeyLabel = [[UILabel alloc]init];
//        [self.contentView addSubview:self.mongeyLabel];
        self.imgView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imgView];
        self.decorationLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.decorationLabel];
        self.serviceLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.serviceLabel];
        self.productLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.productLabel];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.imgView setImageWithURL:[NSURL URLWithString:self.singleBusiness.img] placeholderImage:[UIImage imageNamed:@"hold.png"]];
    self.nameLabel.text = self.singleBusiness.name;
//    self.mongeyLabel.text = [NSString stringWithFormat:@"￥%@/人",self.singleBusiness.avg_price];
    self.decorationLabel.text = [NSString stringWithFormat:@"环境:%@", self.singleBusiness.decoration_score];
    self.productLabel.text = [NSString stringWithFormat:@"效果:%@",self.singleBusiness.product_score];
    self.serviceLabel.text = [NSString stringWithFormat:@"服务:%@", self.singleBusiness.service_score];
    self.imgView.frame = CGRectMake(10, 10, self.contentView.frame.size.width / 3, 100);
    self.nameLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + 20, 10, self.contentView.frame.size.width / 3 * 2 - 20, self.contentView.frame.size.height / 3);
    self.serviceLabel.font = [UIFont fontWithName:@".HelveticaNeueInterface-Regular" size:15];
    self.decorationLabel.font = [UIFont fontWithName:@".HelveticaNeueInterface-Regular" size:15];
    self.productLabel.font = [UIFont fontWithName:@".HelveticaNeueInterface-Regular" size:15];
//    self.mongeyLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + 20, self.contentView.frame.size.height / 5, self.contentView.frame.size.width / 3, self.contentView.frame.size.height / 3 * 2);
    
    
    self.decorationLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + 20, self.contentView.frame.size.width / 5 + 10, self.contentView.frame.size.width / 9 * 2 , self.contentView.frame.size.height / 3);
    self.productLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + self.contentView.frame.size.width / 9 * 2 + 10,self.contentView.frame.size.width / 5 + 10 , self.contentView.frame.size.width / 9 * 2, self.contentView.frame.size.height / 3);
    self.serviceLabel.frame = CGRectMake(self.contentView.frame.size.width / 3 + self.contentView.frame.size.width / 9 * 4, self.contentView.frame.size.width / 5 + 10, self.contentView.frame.size.width / 9 * 2, self.contentView.frame.size.height / 3);
};
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)dealloc
{
    [_nameLabel release];
//    [_mongeyLabel release];
    [_serviceLabel release];
    [_decorationLabel release];
    [_imgView release];
    [_productLabel release];
    [super dealloc];
}
@end
